package com.tmqSoft.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.tmqSoft.dao.TbItemMapper;
import com.tmqSoft.dao.domain.TbItem;
import com.tmqSoft.dao.domain.TbItemExample;
import com.tmqSoft.dao.domain.TbItemExample.Criteria;
import com.tmqSoft.service.ItemService;

@Service("itemService")
public class ItemServiceImpl implements ItemService {

    @Autowired
    private TbItemMapper itemMapper;
    
    @Override
    public TbItem geTbItemById(Long itemId) {

      //  return itemMapper.selectByPrimaryKey(itemId);
        
      //添加查询条件
        TbItemExample example = new TbItemExample();
        Criteria criteria = example.createCriteria();
        criteria.andIdEqualTo(itemId);
        List<TbItem> list = itemMapper.selectByExample(example);
        if (list != null && list.size() > 0) {
            TbItem item = list.get(0);
            return item;
        }
        
        return null;

    }

}
